//
//  UIView+AYExtension.m
//  CreateTools
//
//  Created by AY on 16/6/27.
//  Copyright © 2016年 Jasperay. All rights reserved.
//

#import "UIView+AYExtension.h"

@implementation UIView (AYExtension)

+ (instancetype)ay_viewFromXib
{
    return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].firstObject;
}


- (void)setAy_x:(CGFloat)ay_x
{
    CGRect frame = self.frame;
    frame.origin.x = ay_x;
    self.frame = frame;
}

- (CGFloat)ay_x
{
    return self.frame.origin.x;
}

- (void)setAy_y:(CGFloat)ay_y
{
    CGRect frame = self.frame;
    frame.origin.y = ay_y;
    self.frame = frame;
}

- (CGFloat)ay_y
{
    return self.frame.origin.y;
}

- (CGFloat)ay_width
{
    return self.frame.size.width;
}

- (void)setAy_width:(CGFloat)ay_width
{
    CGRect frame = self.frame;
    frame.size.width = ay_width;
    self.frame = frame;
}


- (CGFloat)ay_height
{
    return self.frame.size.height;
}

- (void)setAy_height:(CGFloat)ay_height
{
    CGRect frame = self.frame;
    frame.size.height = ay_height;
    self.frame = frame;
}

- (void)setAy_size:(CGSize)size{
    CGRect rect = self.frame;
    rect.size = size;
    self.frame = rect;
}

- (CGSize)ay_size{
    return self.frame.size;
}


- (void)setAy_centerX:(CGFloat)ay_centerX{
    CGPoint point = self.center;
    point.x = ay_centerX;
    self.center = point;
}


- (CGFloat)ay_centerX{
    return self.center.x;
}

- (void)setAy_centerY:(CGFloat)ay_centerY{
    CGPoint point = self.center;
    point.y = ay_centerY;
    self.center = point;
}


- (CGFloat)ay_centerY{
    return self.center.y;
}




@end
